<?php
/**
 * 创建新评论的表单AJAX提交之后, 此时的评论列表亦应该更新才
 */

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
?>
<div class="article-form">
<?php
$form = ActiveForm::begin([
    'id' => 'new-comment-form',
    'enableAjaxValidation' => true,
    'validationUrl' => Url::toRoute(['comment/create-validate']),
    'action' => Url::toRoute(['comment/create']),
]);
?>

<?= Html::activeHiddenInput($comment, 'pcid', ['value' => 0]) ?>
<?= Html::activeHiddenInput($comment, 'aid') ?>
<?= $form->field($comment, 'commenter')->textInput() ?>
<?= $form->field($comment, 'email')->textInput() ?>
<?= $form->field($comment, 'content')->textarea(['rows' => 6]) ?>
<?= $form->field($comment, 'subscribe')->checkBox() ?>

<div class="form-group">
    <?= Html::submitButton('Publish', ['id' => 'new-comment-submit', 'class' => 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>
</div>
